﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <!-- JavaScript Includes -->
    <script src="@Url.Content("~/Scripts/jquery-1.7.2.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.22.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.blockUI.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/JGrowl/jquery.jgrowl_minimized.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jMenu.jquery.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.ui.timepicker.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/date.format.js")" type="text/javascript"></script>
    <!-- Style Sheets -->
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Scripts/JGrowl/jquery.jgrowl.css")" rel="stylesheet" type="text/css"/>
    <link href="@Url.Content("~/Content/themes/cupertino/jquery-ui-1.8.22.custom.css")" rel="stylesheet" type="text/css"/>
    <link href="@Url.Content("~/Content/jMenu.jquery.css")" rel="stylesheet" type="text/css"/>
    <link href="@Url.Content("~/Content/jquery.ui.timepicker.css")" rel="stylesheet" type="text/css"/>
    @RenderSection("HeaderIncludes", false)
    
    <!-- Google Analytics -->
    <script type="text/javascript">

        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-35022346-1']);
        _gaq.push(['_setDomainName', 'belmontbaptist.org.au']);
        _gaq.push(['_trackPageview']);

        (function () {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();

    </script>   
</head>
<body>
    <script language="javascript" type="text/javascript">
        function ToggleMinusAdd(source) {
            if ($(source).attr('src') == '@Url.Content("~/Content/Images/add.png")') {
                $(source).attr('src', '@Url.Content("~/Content/Images/minus.png")');
            } else {
                $(source).attr('src', '@Url.Content("~/Content/Images/add.png")');
            }
        }

        function ToggleHideShow(source, targetId) {
            $("#" + targetId).toggle();
            ToggleMinusAdd(source);
        }
    </script>
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            // This is all text inputs ---------------------------------------
            $("input[type=text], textarea, select, input[type=password]").addClass("idle");

            $("input[type=text], textarea, select, input[type=password]").focus(function () {
                $(this).addClass("activeField").removeClass("idle");
            }).blur(function () {
                $(this).removeClass("activeField").addClass("idle");
            });

            // All Date Time inputs ------------------------------------------        
            $(function () {
                $(".JDateTime").datepicker();
            });
            $(".JDateTime").datepicker(
                {
                    minDate: new Date(2000, 1 - 1, 1),
                    dateFormat: 'dd/mm/yy',
                    changeMonth: true,
                    changeYear: true
                }
            );

            $(".JDateTime").addClass("idle");
            $(".JDateTime").focus(function () {
                $(this).addClass("activeField").removeClass("idle");
            }).blur(function () {
                $(this).removeClass("activeField").addClass("idle");
            });

            $(".JDateTime").keyup(function (evt) {
                if (evt.keyCode != '8') {
                    if (evt.target.value.length == 2) evt.target.value = evt.target.value + "/";
                    if (evt.target.value.length == 5) evt.target.value = evt.target.value + "/";
                }
                if (evt.target.value.length >= 11) {
                    evt.target.value = evt.target.value.substring(0, 10);
                }
            });

            // Menu Options ---------------------------------------------------
            $("#jMenu").jMenu();

            // Generic Ajax Error Handling...
            $.ajaxSetup({
                error: function (jqXHR, exception) {
                    if (jqXHR.status === 0) {
                        $.jGrowl('Not connect.\n Verify Network.', { header: 'Warning', theme: 'alertGrowlUI', sticky: true }); // show error message
                    } else if (jqXHR.status == 404) {
                        $.jGrowl('Requested page not found. [404]', { header: 'Warning', theme: 'alertGrowlUI', sticky: true }); // show error message
                    } else if (jqXHR.status == 500) {
                        $.jGrowl('Internal Server Error [500].', { header: 'Warning', theme: 'alertGrowlUI', sticky: true }); // show error message
                    } else if (exception === 'parsererror') {
                        $.jGrowl('Requested JSON parse failed.', { header: 'Warning', theme: 'alertGrowlUI', sticky: true }); // show error message
                    } else if (exception === 'timeout') {
                        $.jGrowl('Time out error.', { header: 'Warning', theme: 'alertGrowlUI', sticky: true }); // show error message
                    } else if (exception === 'abort') {
                        $.jGrowl('Ajax request aborted.', { header: 'Warning', theme: 'alertGrowlUI', sticky: true }); // show error message
                    } else {
                        $.jGrowl('Uncaught Error.\n' + jqXHR.responseText, { header: 'Warning', theme: 'alertGrowlUI', sticky: true }); // show error message
                    }
                }
            });
        });
    </script>
    <!-- This will setup the messaging for the jgrowl system -->
    @if (ViewBag.SuccessMessage != null)
    {
        // Is there any messages???
        <script language="javascript" type="text/javascript">
            $(document).ready(function () {
                $.jGrowl('@Html.Raw(ViewBag.SuccessMessage)', { header: 'Success', sticky: true, theme: 'successGrowlUI' });
            });
        </script>
    }
    @if (ViewBag.ErrorMessage != null)
    {
        // Is there any messages???
        <script language="javascript" type="text/javascript">
            $(document).ready(function () {
                $.jGrowl('@Html.Raw(ViewBag.ErrorMessage)', { header: 'Warning', sticky: true, theme: 'alertGrowlUI' });
            });
        </script>
    }
    @if (ViewBag.Message != null)
    {
        // Is there any messages???
        <script language="javascript" type="text/javascript">
            $(document).ready(function () {
                $.jGrowl('@Html.Raw(ViewBag.Message)', { header: 'Message', sticky: true, theme: 'messageGrowlUI' });
            });
        </script>
    }

    <div id="page-wrapper">
        <div class="wrapper-resize">
            <div id="page-content">
                @RenderBody()
            </div>
        </div>
    </div>
</body>
</html>
